Skip to content

A hand-off to a person is typed, and CoderHelm owns its own limits - #930

Merged
coderhelm[bot] merged 3 commits into
mainfrom
person-only-handoffs
Dec 1, 2026
Merged

coderhelm[bot] merged 3 commits into
mainfrom
person-only-handoffs

Conversation

@nambok

@nambok nambok commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

When CoderHelm hit a limit of its own, it handed the job to a person or let the pull request sit. That covered its sandbox, its network allowlist, its time budget, its tools, its use of CI, and a proof its own review asked for that none of its routes could run. This change makes every hand-off typed so a CoderHelm-owned limit can't become a person's step. It also stops CoderHelm's reviewer from blocking its own pull request on something no route can satisfy, adds a stall detector, and counts hand-offs so a rise shows.

This is the second of two pull requests. #927 covers derived egress and proof routes: the sandbox's network allowlist, taken from the default branch's config and deploy outputs, and the proof plan's routes (the sandbox against the preview, then staging, then an app started in the sandbox, then CI repeats).

Changes

  • Typed hand-offs (common::person_only). PersonOnly is a closed set: a named permission an owner or admin grants, a product decision, an approval the repository's or team's rules require, a credential only the person holds, work someone else holds, or a real-world action (a purchase with real money, a real device). Its text (Named) is private to the module, so a hand-off can't be built from loose words; a compile_fail doctest shows this. No variant covers CoderHelm's sandbox, allowlist, budgets, tools, CI use, labels, tests or reads.
    • One parser (parse, of_reason, of_human_only) returns Result<PersonOnly, OwnProblem>.
    • The catch-all "outside every system" reason reaches a person only when its words name a real-world action or one of the listed reasons.
  • Every builder goes through the parser:
    • the person gate's items, from one constructor (human_item). A CoderHelm-owned item becomes Work::Problem, never Outcome::Human;
    • hand-backs (HandBack::new, human_only_in);
    • a fix round's NEEDS A PERSON line (own_review_ledger::observe).
  • CoderHelm's own problems (own_problems). Each one becomes an internal alert for CoderHelm's maintainers (an error log line carrying CODERHELM_OWN_PROBLEM, and a row kept for 30 days) plus one plain line on the run page. The work then goes on by another route.
  • No review deadlock (review_feasible). On CoderHelm's own pull request, a blocking finding stands only if a route can satisfy it: an edit, a sandbox run, CI, or a page check. What only a person has becomes one typed question; anything else is CoderHelm's note plus an internal alert. It is one call in the reviewer, after the existing rules.
  • Stall detector (own_problems::check, one line in the 15-minute sweep). A pull request with no progress for 24 hours gets:
    • a self-diagnosis line on the run page;
    • a retry along its next route (the ready decision, then its own review of the head, then both);
    • an internal alert.
      It acts at most once a day per pull request, claimed on the run.
  • Measurement. The team's HANDOFF_STATS item counts hand-offs by reason (person_<reason>), CoderHelm's own problems by subject (own_<subject>), stalls, and pr_blocked_secs. Each run also keeps blocked_secs.
  • Incident case xd_own_limits_never_a_persons: invented acme bookstore replays.

Verification

  • New tests:
    • every CoderHelm-owned wording is refused by every reason, every hand-off kind, the gate (all item kinds), human_only_in and HandBack::new;
    • what only a person has still reaches them, named, and is counted by reason;
    • the reviewer's feasibility check keeps code defects and proofs some route can run as blocks;
    • the stall detector diagnoses after a day and moves to the next route;
    • a source scan fails if a new file builds or reads a hand-off without person_only, or if a HumanItem is built outside its one constructor.
  • cargo fmt --all --check, rustfmt --check --edition 2021 worker/src/passes/incidents/*.rs, cargo clippy -p common -p worker -p gateway --all-targets -- -D warnings and cargo test -p common -p worker -p gateway pass. The brand spelling and example domain checks pass too.

A hand-off is a PersonOnly from a closed set (a named permission an owner or
admin grants, a product decision, an approval the rules require, a credential,
work someone else holds, a real-world action), built only through
common::person_only. Words about CoderHelm's sandbox, allowlist, budgets,
tools, CI use, labels, tests or reads make an OwnProblem instead: an internal
alert and one run-page line. The person gate, hand-backs and a fix round's
NEEDS A PERSON line all go through it.

On its own pull request the reviewer blocks only on what a route can satisfy
(review_feasible). A pull request with no progress for a day is diagnosed,
retried along its next route and alerted (own_problems::check on the sweep).
Hand-offs are counted per team by reason, own problems by subject, with the
time each pull request spent blocked.

Incident case xd_own_limits_never_a_persons.
@nambok nambok added the ch-review CoderHelm reviews this pull request label Dec 1, 2026
coderhelm[bot]
coderhelm Bot previously requested changes Dec 1, 2026

@coderhelm coderhelm Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved with notes 33b6a17 (merged)

Comment thread services/common/src/person_only.rs Resolved
Comment thread services/common/src/person_only.rs Resolved
Comment thread services/worker/src/passes/review_pr.rs Resolved
Comment thread services/worker/src/passes/review_pr.rs Resolved
Comment thread services/worker/src/passes/settle.rs Resolved
}

/// The count attribute for an own problem's subject.
pub fn own_attr(s: OwnSubject) -> String {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 FYI: Near-identical helpers added together (scope, not verified)

services/worker/src/passes/own_problems.rs adds own_attr next to person_attr, added in the same change. Keep one helper with the shared logic (a parameter for what differs) and call it from both places. If the ticket truly needs it, say why on a line Wider than the ticket: services/worker/src/passes/own_problems.rs: <why>.

FYI, not a block: on the whole picture this is not a named correctness, security or data-loss problem to hold the merge on.

coderhelm[bot]

This comment was marked as outdated.

@coderhelm
coderhelm Bot dismissed their stale review December 1, 2026 03:18

Superseded by CoderHelm's latest review

@coderhelm

coderhelm Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Post-merge health check: deploy cancelled: the deploy for 1f06235 was cancelled; nothing later deployed it.

coderhelm[bot]

This comment was marked as outdated.

@coderhelm coderhelm Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved with notes 4fcbacb (merged)

@coderhelm
coderhelm Bot merged commit 1f06235 into main Dec 1, 2026
18 checks passed
nambok added a commit that referenced this pull request Dec 1, 2026
…ror reads as one a person must repair (#937)

* A hand-off to a person is typed, and CoderHelm owns its own limits

A hand-off is a PersonOnly from a closed set (a named permission an owner or
admin grants, a product decision, an approval the rules require, a credential,
work someone else holds, a real-world action), built only through
common::person_only. Words about CoderHelm's sandbox, allowlist, budgets,
tools, CI use, labels, tests or reads make an OwnProblem instead: an internal
alert and one run-page line. The person gate, hand-backs and a fix round's
NEEDS A PERSON line all go through it.

On its own pull request the reviewer blocks only on what a route can satisfy
(review_feasible). A pull request with no progress for a day is diagnosed,
retried along its next route and alerted (own_problems::check on the sweep).
Hand-offs are counted per team by reason, own problems by subject, with the
time each pull request spent blocked.

Incident case xd_own_limits_never_a_persons.

* Waiting runs go on by themselves, and texts say what actually happens

A run waiting on a person resumes when what it waits for arrives: a
comment or reply on its ticket (Jira, or a plain comment on the GitHub
issue), access granted on GitHub or a repository turned on, or usage
limits saved that allow runs. Wait actions name the one thing to do and
where, never "then press Retry".

The wrong-repo note names the `Repo:` line and cuts its reason at a word.
Tests-and-scope notes no longer quote the coding model's instructions.
Fix rounds get update_pr_description with the feedback round's guard.
PR labels are CoderHelm's to add, and an unblock never ends in "or run
the command yourself". The updater waits out a busy stack and retries a
rollback caused by throttling by itself; a failed update stack in another
account gets one AWS admin action. person_text guards each of these texts.

* Usage-limit, reopened-change, approval and alert waits go on by themselves

Runs waiting on the usage limit start again from the 15-minute sweep once
the team's limit allows runs, so a new month resets them. A run whose
change closed goes back to waiting when the change is reopened, and goes
on when it merges. An answered approval resumes the same run with the
work it kept. An alert run resumes when its alert fires again and closes
when it clears; its wait says what to do first, then Retry on the run page.

* A woken run that couldn't be queued waits again, and only a closed change's stop is read as one

- A wake (gateway event or the worker's limit sweep) that marked the waiting
  run superseded but couldn't queue its new run puts it back to waiting, with
  the status key and ending it had, only while it still holds that wake's
  write (common::run_wake::put_back). The ticket is serialized before the
  write, so only the send can fail after it.
- A woken security fix run starts as Retry starts it: a new request for its
  unit's findings (security::retry_event), not its ticket again.
- The change-wait sweep reads a run as "its change closed" only when its wait
  is that stop (change_wait::waits_on_close). A run keeps the change it
  waited on after it went on, so a later question, approval or person's stop
  is never overridden.
- A comment no longer restarts a run a person stopped or put back to draft
  (HumanOnly::PersonAction); only that person's Retry or ready does.
- A label item that names production, a release or a publish in any word
  (deploy-prod, release, CI:DEPLOY_PRODUCTION) stays the team's call.
- An update stack still rolling back (_IN_PROGRESS) is told to wait, never
  to update again or delete.
- one_way finds its cut in an ASCII-lowercased copy, so the offset is
  always a char boundary of the text it cuts.

* A run the token limit refuses pauses and goes on by itself, and no error reads as one a person must repair

A model call refused by the team's monthly token limit ("limit reached")
was read as an error nobody knew, so the run stopped as "an error it
doesn't know how to repair ... put it right, then press Retry" and waited
on a person past the month's turn.

- The refusal is a typed pause (common::token_room, Kind::TokenLimit):
  the run keeps its continuation and resumes in place, from the step that
  was refused, when the month turns or the limit is raised. #924's
  wake_limit_waits hands these waits to token_room::wake_team.
- New runs wait for token room when what is left is less than a run of
  their kind takes; a run under way waits before building; runs in
  progress come first on what is left.
- Warnings at 80% and 95%, once each a month, with the day the limit runs
  out at this pace; /api/usage gives warn_level and projected_at.
- A schedule at 00:00 and 00:01 UTC on the 1st sends the sweep; a saved
  limit sends it at once; a paused run gets no reminder.
- A teammate's branch is left as it is: the run works on <branch>-N and
  says so once.
- An error nobody classified is CoderHelm's own problem: retried with
  longer waits, then parked with an internal alert (#930's own_problems);
  the generic frame is gone and person_text refuses it.
- Runs an older release stopped this way are found by their stored words
  and resumed after the deploy.
- Incident case xg_token_limit_pauses_and_resumes.

* A paused run reads as paused in the runs list and the palette, and sends run.paused

- RunSummary gains pause (the list reads waiting_on), and the search the
  command palette uses carries it too, so a run paused on the token limit
  is never listed as waiting for an answer.
- A pause sends the new webhook event run.paused, with its line in error;
  run.needs_input stays for waits a person ends. Both are in the catalog,
  so the OpenAPI document lists them.
- The event scrubber no longer redacts the plain word after "token"
  ("token limit"); a credential after it still is.

---------

Co-authored-by: coderhelm[bot] <272032808+coderhelm[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ch-review CoderHelm reviews this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant